Skip to content

Plugin tests - #2258

Merged
vooon merged 12 commits into
ros2from
plugin-tests
Aug 7, 2026
Merged

vooon merged 12 commits into
ros2from
plugin-tests

Conversation

@vooon

@vooon vooon commented Aug 7, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds service-based integration tests for the command, param, and waypoint (mission) plugins that exercise the exposed ROS API over real ROS interfaces — including error handling and timeout paths — plus a complete plugin ROS API documentation pass.

Tests

Three new gtest suites (mavros-plugin-command, mavros-plugin-param, mavros-plugin-mission) built on a shared TestUAS fixture that captures outbound MAVLink from mavlink_sink and injects inbound messages via plugin_route:

  • command — every ~/cmd service, COMMAND_LONG/COMMAND_INT payloads, ACK results, ACK timeout, broadcast/non-ACK paths.
  • param — set/pull/get flows, Parameter conversion, set/pull timeouts, excluded/unknown-parameter rejections.
  • mission — pull/push/clear/set_current handshakes, item retry, push/pull timeouts, partial-push rejection.

The plugin .cpp files are compiled into the test TUs to keep the approach refactor-free where the classes are otherwise internal.

Production changes

  • Configurable timeouts — param and MissionBase expose ~param/… and ~mission/… timeout/retry parameters instead of hardcoded constants (defaults preserved), so timeout behavior is tunable and testable.
  • Fix latched publishers on intra-process nodes — plugin nodes enable intra-process comms, but rclcpp (e.g. humble) rejects latched (transient_local) publishers/subscriptions on intra-process nodes. Added NonIntraProcessPublisherOptions/SubscriptionOptions and applied them to the transient_local (latched) publishers/subscriptions across waypoint, geofence, rallypoint, global_position, home_position, sys_status, and guided_target, so volatile topics keep the zero-copy path.
  • Fix param union initialization — zero-initialize mavlink_param_union_t in Parameter::to_param_set() to avoid undefined-behaviour padding bytes in PARAM_SET.

Docs

  • Plugin index page (docs/plugins/index.md) listing all plugins with their ROS API surface, generated by a new --plugin-index mode and wired into gendoc.sh and the mkdocs site.
  • Descriptions for every exposed ROS entity (publishers, subscribers, services, clients, parameters) across all 65 plugins (232/232 entities), plus mavlink subprotocol references.
  • Links to the per-package API docs on docs.ros.org and the readthedocs site from the README/docs index (with a readthedocs badge).
  • Removed the obsolete docs/mavlink-e2e-tests-plan.md (pymavlink E2E landed; router covered by benchmarks).

CI

Passing on all distros (humble, jazzy, kilted, lyrical, rolling). Includes hardening for CI-only flakes: initialize rclcpp once per test binary, match the capture subscription QoS, and the latched/intra-process fix above.

vooon added 5 commits August 7, 2026 14:16
Replace the hardcoded PARAM_TIMEOUT/LIST_TIMEOUT/RETRIES_COUNT constants
with node-declared parameters (param_set_timeout, param_list_timeout,
param_retries) so the timeout/retry behavior can be tuned and tested.
Recreate the retry wall-timer when param_set_timeout changes.

Also zero-initialize the mavlink_param_union_t in to_param_set() to avoid
undefined-behaviour padding bytes leaking into the PARAM_SET payload.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Replace the hardcoded WP_TIMEOUT/LIST_TIMEOUT/RETRIES_COUNT/RESCHEDULE_TIME
constants in MissionBase with node-declared parameters (mission_wp_timeout,
mission_list_timeout, mission_retries, mission_reschedule_time) so the
timeout/retry behavior can be tuned and tested. Recreate the retry wall-timer
when mission_wp_timeout changes.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Add gmock/gtest suites that exercise the exposed ROS API of the command,
param and waypoint (mission) plugins over real ROS interfaces, using a shared
TestUAS fixture that captures outbound MAVLink from mavlink_sink and injects
inbound messages via plugin_route.

- command (mavros-plugin-command): each ~/cmd service, COMMAND_LONG/INT
  payload, ACK result, ACK timeout, broadcast/non-ACK paths.
- param (mavros-plugin-param): set/pull/get flows, Parameter conversion,
  set/pull timeouts, excluded/unknown-parameter rejections.
- mission (mavros-plugin-mission): pull/push/clear/set_current handshakes,
  item retry, push/pull timeouts, partial-push rejection.

The plugin .cpp files are compiled into the test TUs to keep the approach
refactor-free where the classes are otherwise internal.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Add a reference to the relevant MAVLink microservice (subprotocol) page in
the doxygen description of each plugin that maps to one. The references flow
through the existing doc extractor/template pipeline.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Regenerated plugin index.json and markdown docs from the updated source
comments (mavlink subprotocol references).

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
@vooon vooon added this to the Version 2.15 milestone Aug 7, 2026
@vooon
vooon requested a lite review from Copilot August 7, 2026 12:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

vooon added 7 commits August 7, 2026 14:46
Generate a combined plugin index (docs/plugins/index.md) listing every
mavros and mavros_extras plugin with its ROS API surface (publishers,
subscribers, services, clients, MAVLink sub/pub) and links to the full
per-plugin reference. The index is produced by plugin_doc_gen --plugin-index
and wired into gendoc.sh.

Add a Documentation link to the readthedocs site and the plugin index from
the top-level README.

Remove the obsolete docs/mavlink-e2e-tests-plan.md (pymavlink E2E coverage is
landed and the router is covered by benchmarks).

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
When scanning for a description comment above a create_publisher/service
declaration, skip a single assignment-prefix line (e.g. "foo_pub =") so a
//! comment placed above the whole statement is attributed to the created
entity. This matches the standard multi-line declaration style used across
the plugins.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Add one-line //! descriptions for every exposed publisher, subscriber,
service, client and parameter across all mavros and mavros_extras plugins,
so the generated per-plugin docs describe what each ROS entity does.

Regenerate the plugin docs and index, and add a readthedocs Documentation
badge to the README.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Fix two classes of failures seen only on the CI runners (not locally):

- Initialize rclcpp once per test binary instead of per test. Repeated
  rclcpp::init()/shutdown() across the integration tests hung on lyrical and
  rolling CI (FastDDS SHM / context teardown). Add TestUAS::Init() called from
  main() and stop calling shutdown() in the fixture.

- Match the capture subscription QoS to the sink publisher (best_effort +
  durability_volatile). On humble this avoided the intraprocess-communication
  exception thrown while subscribing in SetUp, which crashed the mission
  suite.

Also move the pure Parameter conversion tests into a lightweight fixture that
does not construct the ROS node stack, reducing node churn.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Plugin nodes enable intra-process comms, but rclcpp (e.g. humble) rejects
creating a latched (transient_local) publisher or subscription on an
intra-process node: "intraprocess communication allowed only with volatile
durability". This made the waypoint/geofence/rallypoint/global_position/
home_position/sys_status plugins (which publish latched state) fail to start
on humble, and the mission plugin test crash in CI.

Add NonIntraProcessPublisherOptions()/NonIntraProcessSubscriptionOptions()
helpers and pass them to the transient_local publishers and subscriptions, so
those entities opt out of intra-process delivery while volatile topics keep
the zero-copy path.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Link the auto-generated per-package C++/Python API reference
(docs.ros.org/en/rolling/p/mavros*, libmavconn) from the README and the
docs index, alongside the readthedocs site and plugin index.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
Agents must never print, echo, export, or otherwise output the value of any
*_TOKEN/*_SECRET/*_KEY ... environment variable,
referencing them only by name (e.g. "$GITHUB_MCP_RO_TOKEN") and
preferring MCP/tooling that handles auth internally.

Signed-off-by: Vladimir Ermakov <vooon341@gmail.com>
@vooon
vooon merged commit aa6b790 into ros2 Aug 7, 2026
6 of 9 checks passed
@vooon
vooon deleted the plugin-tests branch August 7, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants